package org.newbee.dcs.commons;


import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.concurrent.AtomicInitializer;
import org.apache.commons.lang3.concurrent.ConcurrentException;
import org.newbee.des.zkclient.User;

/**
 * Created by yujie on 2016/10/21.
 */
public class Test implements Runnable {

    static AtomicInitializer<User> userAtomicInitializer;

    public static void main(String[] args) {

        //首字母大写
        System.out.println(StringUtils.capitalize("adfadsfasdfsa aff"));

        //缩写
        System.out.println(StringUtils.abbreviate("书法付水电费水电费水电费", 5));


        System.out.println(StringUtils.appendIfMissing("bbbbbb", "a", "a"));


    }

    @Override
    public void run() {
        try {
            userAtomicInitializer = new AtomicInitializer<User>() {
                @Override
                protected User initialize() throws ConcurrentException {
                    User user = User.of(Thread.currentThread().getName(), "123");
                    return user;
                }
            };
            System.out.println(userAtomicInitializer.get());
        } catch (ConcurrentException e) {
            e.printStackTrace();
        }
    }
}
